/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ULHT.LIG2N1.RC.VO;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author Administrador
 */
public class QuestionLimitVO {

    private static final long questionScore[] = {0, 100, 200, 300, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 125000, 250000, 500000, 1000000};
    private static final int questionLevel[] = {0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4};
    private static final int questionTimeout[] = {0, 15, 15, 15, 15, 30, 30, 30, 30, 30, 45, 45, 45, 45, 45, 0};
    private String filename = "Q-Limit.Data";

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String getFilename() {
        return filename;
    }
        
    public static long getquestionScore(int question) {
        if (question <= questionScore.length && question >= 1) {
            return questionScore[question];
        } else {
            return 0;
        }
    }
    
    public static int getquestionLevel(int question) {
        if (question <= questionLevel.length && question >= 1) {
            return questionLevel[question];
        } else {
            return 0;
        }
    }
    
    public static int getquestionTimeout(int question) {
        if (question <= questionTimeout.length && question >= 1) {
            return questionTimeout[question];
        } else {
            return 0;
        }
    }
    
    public QuestionLimitVO loadQuestionLimitVo() throws FileNotFoundException, IOException, ClassNotFoundException{
        FileManage fileManage = new FileManage();
        return fileManage.readQuestionLimitVoFromFile(this.getFilename());
    }
    
    public void writeQuestionLimitVo() throws FileNotFoundException, IOException{
        FileManage fileManage = new FileManage();
        fileManage.writeQuestionLimitVoToFile(this, this.getFilename());
    }
}
